package com.pet.service.impl;

import com.pet.mapper.SysUserMapper;
import com.pet.pojo.SysUser;
import com.pet.pojo.Vo.UserVo;
import com.pet.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 服务层 实现类
 *
 * @author Lch
 */
@Service
public class SysUserServiceImpl implements ISysUserService {

    @Autowired
    private SysUserMapper userMapper;

    @Override
    public SysUser findById(Integer id) {
        return userMapper.findById(id);
    }

    @Override
    public SysUser findByUsername(String username) {
        return userMapper.findByUsername(username);
    }

    /**
     * 根据邮箱查询用户
     * 
     * @param email
     * @return
     */
    @Override
    public SysUser findByEmail(String email) {
        return userMapper.findByEmail(email);
    }

    @Override
    public List<SysUser> findAll() {
        return userMapper.findAll();
    }

    @Override
    public SysUser getByUsernameAndPassword(UserVo userVo) {
        return userMapper.getByUsernameAndPassword(userVo);
    }

    @Override
    public int insertUser(SysUser user) {
        return userMapper.insertUser(user);
    }

    @Override
    public int deleteUser(Integer id) {
        return userMapper.deleteUser(id);
    }

    @Override
    public int updateUser(SysUser user) {
        return userMapper.updateUser(user);
    }
}
